package com.cs.study.homework._0304;

import java.io.FileInputStream;
import java.io.IOException;

public class Demo2 {
    public static void main(String[] args) throws IOException {
        int numCount = 0;
        int charCount = 0;
        int spaceCount = 0;

        FileInputStream in = new FileInputStream("D:\\JavaStudy\\study\\src\\com\\cs\\study\\Demo\\Demo.java");
        int readCount = in.read();
        byte[] bytes = new byte[readCount];
        int readData = in.read(bytes);
        for (int i = 0; i < readCount; i++) {
            if (bytes[i] == ' ') {
                spaceCount++;
            } else if (bytes[i] >= '0' && bytes[i] <= '9') {
                numCount++;
            } else if (bytes[i] >= 'a' && bytes[i] <= 'z') {
                charCount++;
            } else if (bytes[i] >= 'A' && bytes[i] <= 'Z') {
                charCount++;
            }
        }
        System.out.println("numCount = " + numCount);
        System.out.println("spaceCount = " + spaceCount);
        System.out.println("charCount = " + charCount);


    }
}
